import http from '@/assets/utils/request'

/** *根据id获取菜单权限 */
export function getMenuAuth (data) {
  return http(
    {
      fromwho: 'auth',
      url: 'permission/getSysMenuByUid',
      method: 'get'
    },
    data
  )
}
/** *获取权限列表 */
export function getPermissionList (data) {
  return http(
    {
      fromwho: 'auth',
      url: 'permission/listPermission',
      method: 'get'
    },
    data
  )
}
/** *删除权限 */
export function delPermission (data) {
  return http(
    {
      fromwho: 'auth',
      url: 'permission/deletePermissionById',
      method: 'post',
      isalert: true,
      isloading: true
    },
    data
  )
}
/** *获取权限树权限 */
export function getPermissionTree (data) {
  return http(
    {
      fromwho: 'auth',
      url: 'permission/treePermByClass',
      method: 'get'
    },
    data
  )
}
/** *添加权限 */
export function addPermission (data) {
  return http(
    {
      fromwho: 'auth',
      url: 'permission/addPermission',
      method: 'post',
      isalert: true,
      isloading: true
    },
    data
  )
}
/** *编辑权限 */
export function editPermission (data) {
  return http(
    {
      fromwho: 'auth',
      url: 'permission/editPermission',
      method: 'post',
      isalert: true,
      isloading: true
    },
    data
  )
}
/** *获取权限详情*/
export function getPermissionDetail (data) {
  return http(
    {
      fromwho: 'auth',
      url: 'permission/detailsPermissionById',
      method: 'get'
    },
    data
  )
}
/** *获取角色下权限树
 * rid-角色id
*/
export function getPermissionTreeByRole (data) {
  return http(
    {
      fromwho: 'auth',
      url: 'permission/treePermByMarker',
      method: 'get'
    },
    data
  )
}
/** *绑定权限到角色
 * rid-角色id
 * ids-权限id
*/
export function bindPermissionToRole (data) {
  return http(
    {
      fromwho: 'auth',
      url: 'permission/addPermission2Role',
      method: 'post',
      isalert: true,
      isloading: true
    },
    data
  )
}
/** *绑定权限到角色
 * rid-角色id
 * ids-权限id
*/
export function getPermissionBymid (data) {
  return http(
    {
      fromwho: 'auth',
      url: 'permission/getPermByMenuidUid',
      method: 'get'
    },
    data
  )
}

